<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>让坦克开起来</title>
		<style type="text/css">
			input{font-size:26px;margin-top: 20px;}
			body{background-image: url(images/grassland.png);}
			#mytank{position: absolute;left:10px;top:100px}
		</style>
	</head>
	<body>		
		<img id="mytank" src="images/right.png"/>
		<script>

		//199000846 杨紫玲
		var otank = document.querySelector('img');
		var style = getComputedStyle(otank);
		document.onkeydown = function(e){
			if(e.keyCode == "87" || e.keyCode == "38"){
				otank.src='images/up.png';
				otank.style.top = otank.offsetTop - 10 + "px";
			}
			else if(e.keyCode == "83" || e.keyCode == "40"){
				otank.src='images/down.png';
				otank.style.top = otank.offsetTop + 10 + "px";
			}
			else if(e.keyCode == "65" ||e.keyCode == "37"){
				otank.src='images/left.png';
				otank.style.left = otank.offsetLeft - 10 + "px";
			}
			else if(e.keyCode == "68" ||e.keyCode == "39"){
				otank.src='images/right.png';
				otank.style.left = otank.offsetLeft + 10 + "px";
			}
		}
		//199000846 杨紫玲
		document.onmousedown=function(){
				if(event.button==2){
					alert("当前界面禁用右键！");
					return false;
				}
			}
		</script>
	</body>
</html>
